<template>
  <div>
    <div class="upperLevel">
      <img
        @click="$router.push('/recommend')"
        src="../assets/Search/23.png"
        alt=""
      />
      <div @click="$router.push('/login')" class="land" v-if="flag">
        <img src="../assets/Search/24.png" alt="" />
        <div>柠檬</div>
      </div>
      <div class="land" v-if="!flag">
        <img :src="xingx.avatarUrl" alt="" />
        <div>{{ xingx.nickname }}</div>
      </div>
      <div class="infos">
        <li>等级:{{ infoaa.level }}</li>
        <li>上次登录:{{ infoaa.nextLoginCount }}小时</li>
      </div>
    </div>
    <div class="other">
      <ul>
        <li @click="information">
          <img src="../assets/Search/16.png" alt="" />
          <span>个人信息</span>
        </li>
        <li @click="love">
          <img src="../assets/Search/15.png" />
          <span>我的喜欢</span>
        </li>
        <li  @click="ction">
          <img src="../assets/Search/17.png" alt="" />
          <span>收藏</span>
        </li>
        <li>
          <img src="../assets/Search/31.png" alt="" />
          <span>已购歌曲</span>
        </li>
        <li>
          <img src="../assets/Search/34.png" alt="" />
          <span>下载</span>
        </li>
        <li>
          <img src="../assets/Search/35.png" alt="" />
          <span>电台</span>
        </li>
      </ul>
    </div>
    <div class="setUp">
      <ul>
        <li>
          <img src="../assets/Search/8.png" alt="" />
        </li>
        <li @click="tui">
          <span>退出</span>
          <img src="../assets/Search/9.png" alt="" />
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import { getlands, getlanddengji} from "@/api/land";

export default {
  data() {
    return {
      fals: null,
      pduan: [],
      xingx: [],
      infoaa: [],
      flag: true,
      userId: "",
    };
  },
  methods: {
    tui() {
      // console.log(111);
      // this.pduan = [];
      (this.flag = true), localStorage.removeItem("pduan");
    },
    information() {
      if (this.flag == false) {
        this.$router.push({ name: "transceiver", query: { id: this.userId } });
      } else {
        this.$router.push({ name: "login" });
      }
    },
    love() {
      if (this.flag == false) {
        this.$router.push({ name: "xihuan", query: { id: this.userId } });
      } else {
        this.$router.push({ name: "login" });
      }
    },
    ction(){
        if (this.flag == false) {
        this.$router.push({ name: "collection", query: { id: this.userId } });
      } else {
        this.$router.push({ name: "login" });
      }
    },
    Fungetland() {
      getlands({ uid: this.userId }).then((data) => {
        if (data.code == 200) {
          // console.log(data);
        }
      });
    },
    Fungetlanddengji() {
      getlanddengji().then((data) => {
        if (data.code == 200) {
          this.infoaa = data.data;
          console.log(this.infoaa);
        }
      });
    },
  },
  mounted() {
    this.$nextTick(() => {
      this.$parent.getPlayerId(this.fals);
    });
  },
  created() {
    this.pduan = JSON.parse(localStorage.getItem("pduan"));
    // console.log(this.pduan);
    if (this.pduan) {
      this.flag = false;
      this.xingx = this.pduan.profile;
      this.userId = this.pduan.profile.userId;
      this.Fungetlanddengji();
    }
    this.Fungetland();
  },
};
</script>

<style lang="less">
.upperLevel {
  width: 100%;
  height: 250px;
  box-sizing: border-box;
  position: relative;
  img {
    width: 30px;
    position: absolute;
    // float: right;
    top: 10px;
    right: 10px;
  }
  .land {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    background-color: #ee534f;
    img {
      width: 100px;
      border-radius: 50%;
      background-color: white;
      position: absolute;
      top: 22%;
      left: 5%;
    }

    div {
      display: inline-block;
      position: absolute;
      top: 75%;
      left: 6%;
      font-size: 25px;
      color: white;
      font-weight: bolder;
    }
  }
  .infos {
    position: absolute;
    top: 30%;
    right: 20%;
    color: white;
    font-weight: bold;
    li {
      margin-bottom: 10px;
    }
  }
}

.other {
  width: 100%;
  height: 300px;
  box-sizing: border-box;
  ul {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-items: center;
    li {
      width: 160px;
      height: 80px;
      // border-radius: 10px;
      border: 1px solid gray;
      display: flex;
      justify-content: space-evenly;
      align-items: center;
      img {
        width: 25px;
        height: 25px;
      }
      span {
        display: inline-block;
        width: 80px;
        text-align: center;
      }
    }
    li:nth-child(1) {
      border-bottom-right-radius: 20px;
      border-bottom-left-radius: 20px;
    }
    li:nth-child(2) {
      border-bottom-left-radius: 20px;
      border-bottom-right-radius: 20px;
    }
    li:nth-child(3) {
      border-radius: 20px;
    }
    li:nth-child(4) {
      border-radius: 20px;
    }
    li:nth-child(5) {
      border-top-right-radius: 20px;
      border-top-left-radius: 20px;
    }
    li:nth-child(6) {
      border-top-left-radius: 20px;
      border-top-right-radius: 20px;
    }
  }
}
.setUp {
  width: 100%;
  height: 55px;
  position: fixed;
  bottom: 0px;
  ul {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    li {
      width: 45%;
      img {
        width: 20px;
        height: 20px;
      }
    }
    li:nth-child(2) {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      box-sizing: border-box;
      span {
        margin-right: 5px;
      }
    }
  }
}
</style>